package com.mybatistest.controller;

import com.mybatistest.pojo.Dept;
import com.mybatistest.pojo.PageBean;
import com.mybatistest.service.DeptService;
import com.mybatistest.service.EmpService;
import com.mybatistest.service.impl.EmpServiceImpl;
import com.mybatistest.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RequestMapping("/emp")
@RestController
public class EmpController {

    @Autowired
    @Qualifier("empServiceImpl")
    private EmpService empService;
    @Autowired
    @Qualifier("demoServiceImpl")
    private EmpService demoService;


    @GetMapping
    public Result page(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer pageSize) {
        PageBean page1 = empService.page(page, pageSize);
        return Result.success(page1);
    }

    @GetMapping("/test")
    public Result test() {
        demoService.test();
        return Result.success();
    }


}
